<!DOCTYPE html>
<html lang='zh-CN'>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <title>中奖记录</title>
    <link rel="icon" href="favicon.ico" type="image/ico">
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/materialdesignicons.min.css" rel="stylesheet">
    <link href="css/animate.css" rel="stylesheet">
    <link href="css/style.min.css" rel="stylesheet">
    <link href="js/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
</head>
<body>
<div class="container-fluid p-t-15">
    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-header">
                    <div id="toolbar" class="toolbar-btn-action">
                        <form class="form-inline" method="post" id="searchForm">
                            <div class="form-group">
                                <label>会员ID:</label>
                                <input type="text" class="form-control" name="memberId">
                            </div>
                            <div class="form-group">
                                <button class="btn btn-info btn_query btn-round" type="button" id="searchFormBtn">查询</button>
                            </div>
                        </form>
                    </div>
                    <div class="card-body">
                        <table id="grid_data" class="table text-nowrap"></table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/bootstrap-table/bootstrap-table.js"></script>
<script type="text/javascript" src="js/bootstrap-table/bootstrap-table-zh-CN.min.js"></script>
<script type="text/javascript" src="js/zero2one/zero2one.version.js"></script>
<script type="text/javascript" src="js/zero2one/zero2one.core.js"></script>
<!-- bootstrap表单验证插件 -->
<script type="text/javascript" src="js/bootstrapvalidator/dist/js/bootstrapValidator.js"></script>
<!-- bootstrap弹出框插件 -->
<script type="text/javascript" src="js/jquery.bootstrap.min.js"></script>
<!-- 表单填充插件 -->
<script type="text/javascript" src="js/jquery-form/jquery.formloader.js"></script>
<script type="text/javascript" src="js/zero2one/zero2one.curd.js"></script>
<script type="text/javascript">

    //设置表头
    var columns = [
        {checkbox: true},
        {field: 'id',title: '编号'},
        {field: 'memberId',title: '会员ID'},
        {field: 'prizeId',title: '奖品ID'},
        {field: 'prizeName',title: '奖品名称'},
        {field: 'winTime',title: '中奖时间', formatter: function (value,row,index) {
                return zero2one.dateFormat(value, 'Y-m-d H:i:s')
            }},
        {field: 'statusId',title: '状态',formatter: function (value, row, index) {
                var checked = value == 1 ? "checked" : "";
                return '<label class="lyear-switch switch-solid switch-success"><input type="checkbox" '+checked+' onclick="status('+value+','+row.id+')"><span></span> '+(value== 1 ? "已发放" : "未发放")+' </label>'; }},
        {field: 'grantTime',title: '奖品发放时间', formatter: function (value,row,index) {
                return zero2one.dateFormat(value, 'Y-m-d H:i:s')
            }}
    ];

    //加载列表信息
    zero2one.table("/remote/prizeWin/winList", columns);

    //根据条件查询列表信息
    zero2one.query();

    //修改奖品发放状态
    function status(value,id){
        zero2one. request("/remote/prizeWin/IssueStatus", {"status": value,"id": id},function (data){
            if (data.success) {
                $.messager.alert("温馨提示", "操作成功");
                $('#grid_data').bootstrapTable('refresh');
            } else { $.messager.alert("温馨提示", data.msg) }
        })
    }

</script>
</div>
</body>
</html>
